package com.cfswt.tasksystem.security;


import lombok.Getter;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.User;

import java.util.Collection;

@Getter
public class CustomUserDetails extends User {
    private Integer id;
    private String nickName;
    private Integer isAdmin;
    private String avatar;
    private String email;
    private String mobile;
    private String roles;
    private String depId;
    public CustomUserDetails(Integer id, String nickName, Integer isAdmin, String avatar,
                             String email, String mobile, String depId, String roles,
                             String username, String password, Collection<? extends GrantedAuthority> authorities) {
        super(username, password, true, true, true, true,authorities);
        this.id = id;
        this.isAdmin = isAdmin;
        this.nickName = nickName;
        this.avatar = avatar;
        this.email = email;
        this.mobile = mobile;
        this.depId = depId;
        this.roles = roles;
    }
    @Override
    public String toString() {
        return "CustomUserDetails{" +
                "id=" + id +
                ", nickName='" + nickName + '\'' +
                ", isAdmin=" + isAdmin +
                ", avatar='" + avatar + '\'' +
                ", email='" + email + '\'' +
                ", mobile='" + mobile + '\'' +
                ", roles='" + roles + '\'' +
                ", depId='" + depId + '\'' +
                "} " + super.toString();
    }
}
